define(function (require) {
    'use strict';
    var environment = require('environment');
    var util = require('util');
    var token = util.getToken();
    require('permission');
    require('global');
    var userInfo = require('authorize').getUserInfo();

    var loginOrgName = userInfo.orgCode || util.getCookie('loginOrgName');
    var ydxsHost = environment.ydxs;

    var codeMap = {
        guestAllot : ydxsHost+'/' + loginOrgName +'/admin/clueadmin/clue/index?token='+token,//判客分配
        ruleSet : ydxsHost+'/' + loginOrgName +'/admin/clueadmin/clueofparamset/index?token='+token,//规则管理,
        expandCust: ydxsHost+'/' + loginOrgName +'/admin/clueadmin/clueoftfans/confirm?proj_id=' + util.getUrlPara('proj_id') + '&token=' + token
    };
    function getUrlByCode(code){
        if(!code){
            code = util.getUrlPara('code');
        }
        var mapped = codeMap[code];
        if (code === "guestAllot" && util.getUrlPara('proj_id')) {
            return codeMap['expandCust'];
        }
        //if(mapped){
        //    return encodeURIComponent(ydxsHost+'/' + loginOrgName + '/admin/clueadmin/clue/index?token=' + token);
        //}
        return mapped;
    }
    util.nestIframe('#page_iframe_wrapper',getUrlByCode());
});
